//
//  FeedbackViewController.swift
//  AntProj
//
//  Created by 陈宇 on 2017/5/2.
//  Copyright © 2017年 🐜. All rights reserved.
//

import UIKit
import RxSwift
import RxCocoa

class FeedbackViewController: BaseViewController {
    
    @IBOutlet weak var textView: TextView!
    @IBOutlet weak var btn_commit: UIButton!
    
    override func configureLeftItem() {
        addLeftBarButtonWithImage(#imageLiteral(resourceName: "menu"))
    }
    
    override func configureUI() {
        super.configureUI()
        
        title = "Feedback/Complaint"

        btn_commit.setBackgroundImage(UIImage.image(with: APP.APP_PRIMARY_COLOR, size: CGSize(width: 1, height: 1)), for: .normal)
    }
    
    override func configureEvent() {
        super.configureEvent()
        
        btn_commit.rx.tap.subscribe(onNext: { [unowned self] in
            
            if self.textView.isEmpty {
                self.navigationController?.whisper(title: "请填写反馈信息".localized())
                return
            }
            
            self.navigationController?.whisper(title: "感谢您提交反馈".localized())
            self.navigationController?.popViewController(animated: true)
        }).disposed(by: disposeBag)
    }

}
